/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package STUDENT.NGUYENSANG.OOPs.QuanLiThuVien;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
/**
 *
 * @author NSPDL
 */
    public class SortBQL {

    private String index;
    public void sortByName(){
        Collections.sort(NhapBangQanLi.ListBQL, new Comparator<BangQuanLi>(){
            @Override
            public int compare(BangQuanLi t1,BangQuanLi t2){
                return t1.getTenBanDoc().compareToIgnoreCase(t2.getTenBanDoc());
            }
            });
    }
    public void sortByNum(){
        Collections.sort(NhapBangQanLi.ListBQL, new Comparator<BangQuanLi>(){
            @Override
            public int compare(BangQuanLi t1,BangQuanLi t2){
                int s1 = t1.getSoLuong(),s2 = t2.getSoLuong();
                if(s1 < s2){
                    return 1;
                } 
                if(s1 == s2){
                    return  0;
                }
                return -1;
            }
        });
    }
    public void show()
    {
        System.out.println("Thong Tin Bang Quan Li.");
        for(BangQuanLi index: NhapBangQanLi.ListBQL);
        {
            System.out.println(""+index);
        }
    }
}
